<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of sendmailActionclass
 *
 * @author waterfrog
 */
class Action extends tfAction {

    
    public function sendmailAction() {
  
        $this->assign("msg","Your mail has been sent!");
        ob_start();
        $mailer = tfMailer::newSmtpMailer("localhost", 25, "sp02004", "1234qwer")
				->setSubject("這是subject")
				->setFrom("sp02004@localhost")
				->setTo(array("wlf@localhost"))
				->setBody("這是郵件正文!");
        //$mailer->addAttachmentFromFile(BASE_PATH . "TinyFW.kpf");
        $num = $mailer->batchSend();
        printf("一共有 %d 封郵件被正確送出!<br />\r\n",$num);
        //$mail_message = tfMailer::creatMessage($transport);
        //$mail_message->setSubject("hello world".tfRequest::getPostParameter('name'))->setBody(tfRequest::getPostParameter('msg'));
        //$mail_message->setTo(array('redflowflag@gmail.com','wlf@localhost'));
        //$mail_message->setFrom('wlf@localhost');

        //$transport = Swift_MailTransport::newInstance("localhost", 25);
                //->setUsername("wlf")->setPassword("1234qwer");
        echo "<pre>";
        print_r($_SERVER);
        echo "</pre>";
        echo $mailer;
        tfRequest::printParameters();
        $request = ob_get_contents();
        ob_clean();
        //$mail_message->setBody($request);
        
        $this->assign("request",$request);
        
        $this->render_layout("sendmailok.html");
        
    }
}
?>
